<template>
  <!--引入container布局-->
  <el-container class="home_container">
    <el-header>
      <div>
        <img src="../../assets/tu.png" height="60px"/>
      </div>
      <span class="aaa">可视化大数据</span>
      <!--下拉菜单-->
      <el-col :span="30">
        <el-dropdown trigger="click">
      <span class="el-dropdown-link">
        <img src="../../assets/waixingren.png" height="60px"/>
        <!--<i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>-->
      </span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item @click.native="logout">安全退出</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </el-col>
    </el-header>
    <el-container>
      <el-aside :width="isCollapse?'64px':'200px'">
        <div class="toggle-button" @click="toggleCollapase">||||</div>
        <el-menu default-active="2"
                 background-color="#545c64"
                 text-color="#fff"
                 active-text-color="#ffd04b"
                 :collapse="isCollapse"
                 :collapse-transition="false"
                 :router="true"
                 :default-active="activePath">

          <el-menu-item index="/case">
            <img src="../../assets/anli.png" height="25px" align="center"/>
            <template slot="title">
              <span>案例</span>
            </template>
            <!--<span slot="title">案例</span>-->
          </el-menu-item>
          <el-menu-item index="/CreateChart">
            <img src="../../assets/createChart.png" height="25px" align="center"/>
            <template slot="title">
              <span>创建图表</span>
            </template>
          </el-menu-item>
          <el-submenu index="4">
            <template slot="title">
              <img src="../../assets/fenxi.png" height="25px" align="center"/>
              <span>图表展示</span>
            </template>
            <el-menu-item index="/map">地图</el-menu-item>
            <el-menu-item index="/bar">柱状图</el-menu-item>
            <el-menu-item index="/flod">折线图</el-menu-item>
            <el-menu-item index="/scroll">雷达图</el-menu-item>
            <el-menu-item index="/graph">关系图</el-menu-item>
            <el-menu-item index="/Sunburst">旭日图</el-menu-item>
            <el-menu-item index="/3Dbar">3D柱状图</el-menu-item>
            <el-menu-item index="/3Dscatter">3D散点图</el-menu-item>
            <el-menu-item index="/Tree">树图</el-menu-item>
            <el-menu-item index="/JTree">矩形树图</el-menu-item>
          </el-submenu>
        </el-menu>
      </el-aside>

      <el-main>
        <router-view></router-view>
      </el-main>

    </el-container>
  </el-container>
</template>

<script>  export default {
  name: "home",
  data() {
    return {
      isCollapse: false,
      activePath: '/welcome',
    }
  },
  methods: {
    toggleCollapase() {
      this.isCollapse = !this.isCollapse;
    },
    logout() {
      window.sessionStorage.clear(); //清除session
      this.$router.push("/"); //重置路由
    },
    PersonalInformation() {
      this.$router.push({path:"/PersonalInfo"});
    }
  }
}
</script>

<style scoped>
  .home_container {
    height: 100%;
  }

  .el-header {
    background-color: rgba(236, 233, 109, 0.99);
    display: flex;
    justify-content: space-between; /*左右贴边*/
    padding-left: 0%; /*左边界*/
    padding-right: 10px;
    color: #606068;
    font-size: 25px;
    display: flex;
    align-items: center;
  }

  span {
    margin-left: 10px;
    align-items: center;
  }

  .el-aside {
    background-color: #fca4ab;
  }

  .el-menu {
    border-right: none;
  }

  .el-main {
    background-color: #ffffff;
  }

  .toggle-button {
    background-color: #464649;
    font-size: 10px;
    line-height: 24px;
    color: #fffdef;
    text-align: center;
    letter-spacing: 0.2em;
    cursor: pointer;
  }
</style>
